﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Item;
using ItemComponent;
using Item.Buff;
using Battle;
using LitJson;

public static class Editor_DebugItemData
{
    private static string ItemType => typeof(ItemBase).FullName;
    private static string ItemPrefab => "ItemPrefab";

    public static STItemData[] GetDebugItemData()
    {
        List<STItemData> list = new List<STItemData>();
        list.AddRange(GetItemData_Dmg());
        list.AddRange(GetItemData_Buff());
        list.AddRange(GetItemData_Army());
        list.AddRange(GetItemData_AOE());
        list.AddRange(GetItemData_Area());

        list.AddRange(GetItemData_HotFix());
        return list.ToArray();
    }

    private static STItemData[] GetItemData_Dmg()
    {
        return new STItemData[] {
            new STItemData("Gun",ItemType,"枪",ItemPrefab,100,
                new string[]{ ItemTypeConst.Damage,ItemTypeConst.Projectile},
                new STMyComponetData[]{
                    Gun.GetMyComponetData(new ST_GunData(){
                       dBulletSpeed=10f,
                       nBulletDmg=1,
                       dFireInterval=0.1f,
                       nMaxClipCount=10,
                       dClipReLoadTime=1f,
                    }),
                    BuffAdder.GetMyComponetData(new ST_ItemBuffData[]{
                        new ST_ItemBuffData()
                        {
                            strBuffTag=BuffTagConst.GunGroup,
                            dBuffNum=0.2,
                        }
                    },1),
                }),
            new STItemData("Cannon",ItemType,"炮",ItemPrefab,50,
                new string[]{ ItemTypeConst.Damage,ItemTypeConst.Projectile,ItemTypeConst.Range},
                new STMyComponetData[]{
                    Cannon.GetMyComponetData(new ST_GunData(){
                       dBulletSpeed=10f,
                       nBulletDmg=5,
                       dFireInterval=0.1f,
                       nMaxClipCount=1,
                       dClipReLoadTime=1f,
                       specialAtkData=new ST_SpecialAtkData(){
                            nRepelNum=20,
                       },
                    },new ST_RangeData(){
                        dRadius=1f,
                    }),
                }),
            new STItemData("ElectricitySender",ItemType,"电弧",ItemPrefab,50,
                new string[]{ ItemTypeConst.Damage,ItemTypeConst.Element},
                new STMyComponetData[]{
                    ElectricitySender.GetMyComponetData(new ST_GunData(){
                       dBulletSpeed=10f,
                       nBulletDmg=10,
                       dFireInterval=0.1f,
                       nMaxClipCount=1,
                       dClipReLoadTime=1f,
                       specialAtkData=new ST_SpecialAtkData(){
                            nCatapultCount=2,
                       },
                    }),
                }),
            new STItemData("LightningStrike",ItemType,"雷击",ItemPrefab,50,
                new string[]{ ItemTypeConst.Damage,ItemTypeConst.Element,ItemTypeConst.Range},
                new STMyComponetData[]{
                    LightningStrike.GetMyComponetData(new ST_GunData(){
                       dBulletSpeed=10f,
                       nBulletDmg=10,
                       dFireInterval=0.1f,
                       nMaxClipCount=1,
                       dClipReLoadTime=2f,
                    },new ST_RangeData(){
                        dRadius=1,
                    }),
                }),
            new STItemData("RayEmitter",ItemType,"射线",ItemPrefab,50,
                new string[]{ ItemTypeConst.Damage,ItemTypeConst.Range},
                new STMyComponetData[]{
                    RayEmitter.GetMyComponetData(new ST_GunData(){
                       dBulletSpeed=10f,
                       nBulletDmg=3,
                       dFireInterval=0.1f,
                       nMaxClipCount=50,
                       dClipReLoadTime=2f,
                    },new ST_RayEmitterData(){
                        dMaxScale=3,
                        dPercentGrowth=1,
                        dRayLength=3.5,
                        dRayWidth=0.1,
                    }),
                }),
            new STItemData("Gun_PowerGrid",ItemType,"电网节点",ItemPrefab,50,
                new string[]{ ItemTypeConst.Damage,ItemTypeConst.Range,ItemTypeConst.Special},
                new STMyComponetData[]{
                    Gun_PowerGrid.GetMyComponetData(new ST_GunData(){
                       dBulletSpeed=2f,
                       nBulletDmg=3,
                       dFireInterval=0.1f,
                       nMaxClipCount=1,
                       dClipReLoadTime=3f,
                       dLifeTime=5,
                    },new ST_RangeData(){
                        dRadius=1,
                    }),
                }),
            new STItemData("Gun_Tow",ItemType,"绳索",ItemPrefab,50,
                new string[]{ItemTypeConst.Range,ItemTypeConst.Special},
                new STMyComponetData[]{
                    Gun_Tow.GetMyComponetData(new ST_GunData(){
                       dBulletSpeed=10f,
                       nBulletDmg=3,
                       dFireInterval=0.1f,
                       nMaxClipCount=1,
                       dClipReLoadTime=3f,
                       dLifeTime=5,
                       specialAtkData=new ST_SpecialAtkData()
                       {
                           nRepelNum=20,
                       }
                    },new ST_RangeData(){
                        dRadius=1,
                    }),
                }),
        };
    }

    private static STItemData[] GetItemData_Buff()
    {
        return new STItemData[]
        {
            new STItemData("Buff_Power",ItemType,"Power",ItemPrefab,50,
                new string[]{ItemTypeConst.Assist},
                new STMyComponetData[]{
                    BuffAdder.GetMyComponetData(new ST_ItemBuffData[]
                    {
                        new ST_ItemBuffData(){
                            strBuffTag=BuffTagConst.Power,
                            dBuffNum=0.5f,
                        },
                    },1),
                }),
            new STItemData("Buff_Speed",ItemType,"Speed",ItemPrefab,50,
                new string[]{ItemTypeConst.Assist},
                new STMyComponetData[]{
                    BuffAdder.GetMyComponetData(new ST_ItemBuffData[]
                    {
                        new ST_ItemBuffData(){
                            strBuffTag=BuffTagConst.Speed,
                            dBuffNum=0.5f,
                        },
                    },1),
                }),
            new STItemData("Buff_Range",ItemType,"Range",ItemPrefab,50,
                new string[]{ItemTypeConst.Assist},
                new STMyComponetData[]{
                    BuffAdder.GetMyComponetData(new ST_ItemBuffData[]
                    {
                        new ST_ItemBuffData(){
                            strBuffTag=BuffTagConst.Range,
                            dBuffNum=0.5f,
                        },
                    },1),
                }),
            new STItemData("Buff_Catapult",ItemType,"Catapult",ItemPrefab,50,
                new string[]{ItemTypeConst.Assist},
                new STMyComponetData[]{
                    BuffAdder.GetMyComponetData(new ST_ItemBuffData[]
                    {
                        new ST_ItemBuffData(){
                            strBuffTag=BuffTagConst.Catapult,
                            dBuffNum=1,
                        },
                    },1),
                }),
            new STItemData("Buff_Penetrate",ItemType,"Penetrate",ItemPrefab,50,
                new string[]{ItemTypeConst.Assist},
                new STMyComponetData[]{
                    BuffAdder.GetMyComponetData(new ST_ItemBuffData[]
                    {
                        new ST_ItemBuffData(){
                            strBuffTag=BuffTagConst.Penetrate,
                            dBuffNum=1,
                        },
                    },1),
                }),
            new STItemData("Buff_Repel",ItemType,"Repel",ItemPrefab,50,
                new string[]{ItemTypeConst.Assist},
                new STMyComponetData[]{
                    BuffAdder.GetMyComponetData(new ST_ItemBuffData[]
                    {
                        new ST_ItemBuffData(){
                            strBuffTag=BuffTagConst.Repel,
                            dBuffNum=0.5,
                        },
                    },1),
                }),
        };
    }

    private static STItemData[] GetItemData_Army()
    {
        return new STItemData[] {
            new STItemData("Army_MaxNum",ItemType,"兵营",ItemPrefab,50,
                new string[]{ItemTypeConst.Army},
                new STMyComponetData[]{
                    Army.GetMyComponetData(new STArmyData(){
                        nMaxHpNum=100,
                    }),
                }),
            new STItemData("Army_HPS",ItemType,"医院",ItemPrefab,50,
                new string[]{ItemTypeConst.Army},
                new STMyComponetData[]{
                    Army.GetMyComponetData(new STArmyData(){
                        dHPS_Fixed=2,
                        dHPS_Percent=0.01,
                    }),
                }),
            new STItemData("Army_Weapon",ItemType,"地面碉堡",ItemPrefab,50,
                new string[]{ItemTypeConst.Army},
                new STMyComponetData[]{
                    Army.GetMyComponetData(new STArmyData(){
                        dShild_Fixed=5,
                        dShild_Percent=0.05,
                    }),
                }),
        };
    }

    private static STItemData[] GetItemData_AOE()
    {
        return new STItemData[] {
            new STItemData("Gun_AOETest",ItemType,"AOE测试",ItemPrefab,50,
                new string[]{ItemTypeConst.Range,ItemTypeConst.Damage},
                new STMyComponetData[]{
                    Gun_Aoe.GetMyComponetData(new ST_GunData(){
                        dBulletSpeed=5f,
                        nBulletDmg=10,
                        dFireInterval=0.1f,
                        nMaxClipCount=1,
                        dClipReLoadTime=2f,
                        dLifeTime=1,
                    },new ST_AOEData(){
                        dSizeX=1,
                        dSizeY=0.2,
                    }),
                }),
            new STItemData("Gun_AOERepelTest",ItemType,"AOE击退测试",ItemPrefab,50,
                new string[]{ItemTypeConst.Special,ItemTypeConst.Range},
                new STMyComponetData[]{
                    Gun_Aoe.GetMyComponetData(new ST_GunData(){
                        dBulletSpeed=5f,
                        nBulletDmg=0,
                        dFireInterval=0.1f,
                        nMaxClipCount=1,
                        dClipReLoadTime=2f,
                        dLifeTime=1,
                        specialAtkData=new ST_SpecialAtkData(){
                            nRepelNum=20,
                       },
                    },new ST_AOEData(){
                        dSizeX=1,
                        dSizeY=0.2,
                    }),
                }),
        };
    }

    private static STItemData[] GetItemData_Area()
    {
        return new STItemData[] {
            new STItemData("Area_Dmg",ItemType,"攻击场",ItemPrefab,50,
                new string[]{ ItemTypeConst.Damage,ItemTypeConst.Range,ItemTypeConst.Special},
                new STMyComponetData[]{
                    Area_Dmg.GetMyComponetData(new ST_AreaData()
                    {
                        rangeData=new ST_RangeData(){dRadius=1},
                        dAreaMoveSpeed=1f,
                    },new int[]{ 5,5,5}),
                }),
            new STItemData("Area_Debuff",ItemType,"减速场",ItemPrefab,50,
                new string[]{ ItemTypeConst.Debuff,ItemTypeConst.Range,ItemTypeConst.Special},
                new STMyComponetData[]{
                    Area_Debuff.GetMyComponetData(new ST_AreaData()
                    {
                        rangeData=new ST_RangeData(){dRadius=1},
                        dAreaMoveSpeed=1f,
                    },new ST_AreabuffData[]{
                        new ST_AreabuffData()
                        {
                            strBuffName=BuffNameConst.MoveSpeed,
                            dBuffNum=0.5f,
                        },
                    }),
                }),
        };
    }

    private static STItemData[] GetItemData_HotFix()
    {
        List<STItemData> listTmp = new List<STItemData>();

        JsonData jsonData = new JsonData();
        jsonData["NeedNum"] = 100;
        jsonData["GetScience"] = 200;

        STMyComponetData componetData = new STMyComponetData()
        {
            strType = "ILRuntimeProject.ItemComponent.ItemComponent_Test",
            data = jsonData,
        };

        STItemData data = new STItemData("HotFix_Test", ItemType, "研究所", ItemPrefab, 50,
                new string[] { ItemTypeConst.Special },
                new STMyComponetData[]{
                    componetData,
                });

        listTmp.Add(data);

        return listTmp.ToArray();
    }
}
